import Vue from "vue";
import axios from "axios";

//验证当前用户是否登录（登录状态保存cookie）
function checkLogin() {

}

//验证token （过期、错误、正确)   若已登录状态下过期，应立即重新获取token
function checkToken() {

}

//注册
function register() {

}

//登录
function login() {

}

//退出登录，清空数据缓存
function outLogin() {

}

//用户登录提交字段
/*let params = {
    openId : this.pageNum,
    nickname:nickname,
    avatar : avatar,
    type :type,
    language : language
};*/

export default {
    getQueryString: function (name) {
        var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)", "i");
        var r = window.location.search.substr(1).match(reg);
        if (r != null) return unescape(r[2]);
        return null;
    },
    createTimestamp:function () {
        return parseInt(new Date().getTime() / 1000) + '';
    },
    randomString:function (len) {
        len = len || 32;
        var $chars = 'ABCDEFGHJKMNPQRSTWXYZabcdefhijkmnprstwxyz2345678';    /****默认去掉了容易混淆的字符oOLl,9gq,Vv,Uu,I1****/
        var maxPos = $chars.length;
        var pwd = '';
        for (var i = 0; i < len; i++) {
            pwd += $chars.charAt(Math.floor(Math.random() * maxPos));
        }
        return pwd;
    },
	
	
}